package com.example.mymicaihu.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class FragTabAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> list;
    private List<String> titles;

    public FragTabAdapter(@NonNull FragmentManager fm, ArrayList<Fragment> list, List<String> titles) {
        super(fm);
        this.list = list;
        this.titles = titles;
    }
     @NonNull
    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }



}
